rand — Random Values


\begin{rail}
Random : 'rand' '(' ( ()
 \vert ( Scalar ',' Scalar )
 \vert ( '''d...
... ',' Scalar )
 \vert ( '''uniform''' ',' Scalar ',' Scalar )
 ) ')' ;
\end{rail}
rand has two distinct forms. The first form is used to set the distribution that is used to generate random values. The second form actually generates the values. We will look at each form in turn. The second form of the rand function is used to produce random variables from whatever distribution is actually selected at the time. If you supply no arguments, then a random scalar is returned. If you supply two scalar arguments, then a matrix is returned. The first argument specifies the number of rows, and the second argument specifies the number of columns. In addition, you can supply a matrix argument, which must have two elements, where the first is the number of rows, and the second is the number of columns. This is intended for use with the size function. If srand is not used to set the seed value, each session will produce the same results.

Subsections